<template>
	<view class="box">
		<view class="envelopeWrap">
			<view class="cashContent">
				<view class="cashContentwrap">
				
				<view class="cashNo">
					<view>到账银行卡</view>
					<view>中国建设银行（8526）</view>
				</view>

				<view class="cashMoney">
					<view class="cashMoneying">提现金额</view>
					<view class="envelopeContentMoneycash">
						<text>￥</text>
						<input type="number" v-model="money"></input>
					</view>
				</view>

				<view class="cashModal">
					<text>红包余额：¥200.00，</text>
					<text @click="allCash()">全部提现</text>
				</view>

				<view class="cashBtn" v-clickAgain="redEnvelopeCash">
					提现
				</view>
			</view>
			
			</view>
		</view>
	</view>
</template>

<script>
	import api from '../../api/index.js';
	export default {
		data() {
			return {
				infos:'200',//红包余额
				money:''
			}
		},
		mounted() {
			this.getredEnvelope()
		},
		methods: {
			// 获取红包余额
			getredEnvelope(){
				api.myHelp.redEnvelope().then(res => {
					if (res.code == 1) {
						this.infos = res.data
					}
				})
			},
			// 全部提现
			allCash(){
				this.money=this.infos
			},
			// 提现
			redEnvelopeCash(){
				if (!this.money) {
					uni.showToast({
						title: '请输入提现金额',
						duration: 2000,
						icon: 'none'
					});
					return
				}
				api.myHelp.redEnvelopeCash(this.money).then(res => {
					if (res.code == 1) {
						uni.showToast({
							title: '提现成功'
						})
					   uni.navigateBack()
					}
				})
			},
		
		
		}
	}
</script>

<style>
	@import url("./redEnvelopeManagement.css");
</style>
